<%-- 
    Document   : manage_emp
    Created on : Apr 13, 2012, 11:24:10 AM
    Author     : dhananjay
--%>



<%@page import="jobportal.Dbconn"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<script>
    jQuery(document).ready(function(){

        jQuery("#manageemp").validationEngine();
    });
</script>
<script>

    function toggleChecked(status) {
        $(".checkbox").each( function() {
            $(this).attr("checked",status);
        })
    }

</script>


<%@include file="header.jsp" %>


<%
String content="";
         try {
                Connection con=Dbconn.getConn();
                Statement st=con.createStatement();
                ResultSet rs=st.executeQuery("select content from emailmessage where id='BlankMail'");
                if(rs.next()){
                    content=rs.getString("content");
                }
                st.close();
                con.close();
            } catch (Exception e) {
                out.println(e);
            }
%>

<div id="dialog-form" title="Send Email">
    <br/><p class="validateTips">&nbsp;All form fields are required.</p>
   <br/>
        <label for="Subject1"><strong>Subject :</strong></label>
        <br/>&nbsp;<input type="text" name="subject1" id="subject1"  class="validate[required] text ui-widget-content ui-corner-all" style="width: 375px" />
        <br/><br/><label for="message1"><strong>Message :</strong></label>
        <br/>&nbsp;<textarea cols="50" rows="10"  id="message1" name="message1" class="text ui-widget-content ui-corner-all"  ><%=content%></textarea>
   
</div>



<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-left:2px">

    <tr>
        <td align="center" valign="top" style="padding-left:2px; widows:1003px;"><script src="checkall.js"></script>

            <br />

            <table width="100%" border="0" cellpadding="0" cellspacing="1" style="border: 1px solid rgb(169, 211, 225);">
                <tr>
                    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr class="bluebg">
                                <td width="1%" height="19" class="bluebg">&nbsp;</td>
                                <td width="65%" class="bluebg"><strong>Manage Employers
                                    </strong>

                                </td>
                                <td width="34%" align="right" class="bluebg" style="padding-right:5px;">

                                </td>
                            </tr>
                            <tr>
                                <td height="29" colspan="3" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <form name="frm1" id="frm1"  action="ManageEmp" >

                                            <tr>
                                                <td width="57%" align="center" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="0">
                                                        <tr class="menu">
                                                            <td width="2%" align="center" valign="top">
                                                                <input type='checkbox' class="radio" name='checkall' onclick="toggleChecked(this.checked)" /></td>
                                                            <td colspan="3" align="left"><strong>




                                                                    <input type="button" id="SendEmail" name="sendmail" value="Send Email" class="button2"/>



                                                                    <input type="hidden" id="sub" name="sub" value="">
                                                                    <input type="hidden" id="mssg" name="mssg" value="">
                                                                    <input type="hidden" id="action" name="action" value="">



                                                                    <input name="suspend" type="submit" class="button2" id="suspend" value="Suspend" />
                                                                    <input name="active" type="submit" class="button2" id="active" value="Active" />
                                                                    <input name="delete" type="submit" class="button2" id="delete" onclick="javascript: return confirm('Do you really want to delete the Employer(s)?');" value="Delete" />


                                                                </strong></td>
                                                        </tr>
                                                        <tr>              </tr>
                                                        <%
                                                                    Connection con = null;
                                                                    Statement st = null, st1 = null;
                                                                    ResultSet rs = null, rs1 = null;
                                                                    try {
                                                                        con = Dbconn.getConn();
                                                                        st = con.createStatement();
                                                                        st1 = con.createStatement();
                                                                        //int nojobs,activejobs;
                                                                        // rs=select count(*) as cnt from jobs
                                                                        /*company=&contactname=&cat=&url=&Search=Search+Employers*/
                                                                        String company = "", contactname = "", cat = "", url = "";
                                                                        if (request.getParameter("company") != null) {
                                                                            company = request.getParameter("company");
                                                                        }
                                                                        if (request.getParameter("contactname") != null) {
                                                                            contactname = request.getParameter("contactname");
                                                                        }
                                                                        if (request.getParameter("cat") != null) {
                                                                            cat = request.getParameter("cat");
                                                                        }
                                                                        if (request.getParameter("url") != null) {
                                                                            url = request.getParameter("url");
                                                                        }

                                                                        String sql = "select *,date_format(lastlogin,'%a %d-%M-%Y %h:%i:%s %p') as lastlogin1 from company where compname like '%" + company + "%' and personname like '%" + contactname + "%' and cattype like '%" + cat + "%' and url like '%" + url + "%'";
                                                                        //  out.println(sql);
                                                                        rs = st.executeQuery(sql);
                                                                        while (rs.next()) {
                                                        %>
                                                        <tr style="background-color: #4297d7">
                                                            <td align="center" valign="top" >
                                                                <input name="cmcheck[]" type="checkbox" id="cmcheck[]" value="<%=rs.getString("compid")%>" class="validate[minCheckbox[1]] checkbox radio">

                                                            </td>
                                                            <td align="left" valign="middle"  class="detailsbg" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; font-weight:bolder;">&nbsp;</td>
                                                            <td align="left" valign="middle"  class="detailsbg" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; font-weight:bolder;"><%=rs.getString("compname")%></td>
                                                            <td align="right" valign="middle"  class="detailsbg"><a href="edit_emp.jsp?compid=<%=rs.getString("compid")%>" class="dkgytxt" title="View|Edit Details">Edit this Employer</a> </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="center" valign="top" class="detailsbg">&nbsp;</td>
                                                            <td width="11%" align="left" valign="top" class="detailsbg"><img alt="logo" src="../src/getpic.jsp?id=<%=rs.getString("compid")%>&table=company&col=logo&pk_col=compid" width="106" height="55" /></td>
                                                            <td width="51%" align="left" valign="top" class="detailsbg">
                                                                <span class="menu">
                                                                    <strong>Username</strong>: <%=rs.getString("compid")%><br />
                                                                    <strong>Contact Person</strong> : <%=rs.getString("personname")%><br />
                                                                    <strong>Tel. / Mobile</strong> : <%=rs.getString("mobile")%><br />
                                                                    <strong>Email</strong> : <%=rs.getString("email")%> <br />
                                                                    <strong>Website</strong> :<a href="<%=rs.getString("url")%>"  target="_blank"><%=rs.getString("url")%></a><br />
                                                                    <strong>Location</strong> : <%=rs.getString("address")%> &raquo;<%=rs.getString("city")%>&raquo;<%=rs.getString("state")%><br />
                                                                    <%

                                                                                                                                        String sql1 = "select count(*) cnt from jobs where compid='" + rs.getString("compid") + "'";
                                                                                                                                        //out.println(sql1)    ;
                                                                                                                                        rs1 = st1.executeQuery(sql1);
                                                                                                                                        rs1.next();
                                                                    %>
                                                                    <strong>No. of Job posted</strong> : <%=rs1.getInt(1)%><br />
                                                                    <%

                                                                                                                                        sql1 = "select count(*) cnt from job_applied,jobs where job_applied.jobid=jobs.jobid and result='pass' and compid='" + rs.getString("compid") + "'";
                                                                                                                                        // out.println(sql1)    ;
                                                                                                                                        rs1 = st1.executeQuery(sql1);
                                                                                                                                        rs1.next();
                                                                    %>
                                                                    <strong>No. Of Selected Candidate </strong> : <%=rs1.getInt(1)%><br />
                                                                    <strong>Status</strong> :<strong>
                                                                        <%if (rs.getString("status") != null && rs.getString("status").equalsIgnoreCase("verified")) {%>
                                                                        <font color='#00CC00'><%=rs.getString("status")%></font>
                                                                        <%} else {%>
                                                                        <font color='red'><%=rs.getString("status")%></font>
                                                                        <%}%></strong>
                                                                    <br />

                                                                    <strong>Last Login</strong> : <%=rs.getString("lastlogin1")%></span>
                                                            </td>
                                                            <td width="36%" align="left" valign="top" class="detailsbg"><%=rs.getString("profile")%></td>
                                                        </tr>
                                                        <%}
                                                                    } catch (Exception e) {
                                                                        out.println("Exception" + e);
                                                                    } finally {
                                                                        st.close();
                                                                        con.close();
                                                                    }
                                                        %>
                                                        <tr>
                                                            <td align="center" valign="top" class="detailsbg">&nbsp;</td>
                                                            <td colspan="3" align="right" valign="top" class="detailsbg" style="padding-right:5px;"><div class="rf">
				1&nbsp;&nbsp;<span class='alink_blue'><a href='/admin/manage_emp.jsp?cur_page=1&amp;start=1&amp;end=5&&'>2</a></span>&nbsp;&nbsp;<span class='alink_blue'><a href='/admin/manage_emp.jsp?cur_page=2&amp;start=1&amp;end=5&&'>3</a></span>&nbsp;&nbsp;<span class='alink_blue'><a href='/admin/manage_emp.jsp?cur_page=3&amp;start=1&amp;end=5&&'>4</a></span>&nbsp;&nbsp;<span class='alink_blue'><a href='/admin/manage_emp.jsp?cur_page=4&amp;start=1&amp;end=5&&'>5</a></span>&nbsp;&nbsp;<span class='alink_blue'>
                                                                        <a href='/admin/manage_emp.jsp?cur_page=1&&page_record=next&&total_records=&&start=1&amp;end=5&&'>Next</a></span>&nbsp;&nbsp;<span class='alink_blue'>
                                                                        <a href='/admin/manage_emp.jsp?cur_page=4&&page_record=next&&total_records=&&start=1&amp;end=5&&'>Last</a></span>&nbsp;&nbsp;</div></td>
                                                        </tr>


                                                    </table></td>
                                            </tr></form>
                                    </table></td>
                            </tr>
                        </table></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td height="337" colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2"><style type="text/css">
        <!--
        .style1 {font-size: xx-small}
        -->
    </style>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tbody><tr><td><DIV class="GrayTxt SmFont PadFive" align=right><span class="style1"></span><BR>
                    </DIV>
                </td></tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
        </tbody></table></td>
</tr>
</table>
<%@include file="footer.jsp" %>